<!DOCTYPE>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <!--<link href="/Public/css/reset.css" rel="stylesheet" />-->
    <!--<link href="/Public/css/common.css" rel="stylesheet" />-->
    <!--<link href="/Public/css/usercenter.css" rel="stylesheet" />-->
    <!--<link rel="stylesheet" type="text/css" href="/Public/css/global.css" />-->
    <!--<link rel="stylesheet" type="text/css" href="/Public/css/style.css" />-->
    <link rel="stylesheet" href="/Public/bs/css/font-awesome.min.css">
    <link rel="stylesheet" type="text/css" href="/Public/css/mui.min.css" />
    <!--<link rel="stylesheet" href="/Public/css/font-awesome.min.css" />-->
    <!--<script src="/Public/js/jquery-1.10.2.min.js"></script>-->
    <script src="/Public/js/mui.min.js"></script>
    <script src="/Public/js/jquery-2.1.1.min.js"></script>
    <!--<script src="/Public/js/amazeui.min.js"></script>-->
    
    <style type="text/css">
        header.mui-bar.mui-bar-nav{
            background: black;
        }
        a.mui-action-back.mui-icon.mui-icon-left-nav.mui-pull-left{
            color: white;
        }
        img.mui-pull-left{
            height:4rem;
            width: 4rem
        }
        /* .mui-bar .mui-title{
            background: yellow;
        } */
        .mui-table-view-cell:after{
            display: none;
        }
        .mui-table-view-cell.mui-media{
            border-bottom: 0.05rem solid #999;
            width: 96%;
            margin: 0 auto;

        }
    </style>
        

    <script type="text/javascript">
        mui.init({
            pullRefresh: {
                container: '#pullrefresh',
                down: 
                {
                    callback: pulldownRefresh
                },
                up: 
                {
                    contentrefresh: '正在加载...',
                    contentnomore:'没有更多数据了',
                    callback: pullupRefresh
                }
            }
        });  
        
        mui('body').on('click', 'a', function() {
            //mui.alert(123);
            location.href=this.href;
        });
        
        
    

        var count = 0;
        var pageindex = 1;
        var psize = 8;
        function pullupRefresh() {
             //参数为true代表没有更多数据了。
            var table = document.body.querySelector('.mui-table-view');
            mui.ajax('/index.php/home/member/up',{
                data:{
                    index:pageindex++,
                    id:{$_SESSION['msg']['id']},
                    size:psize
                },
                type:'post',//HTTP请求类型
                timeout:10000,//超时时间设置为10秒；        
                success:function(data){                                                                                  
                    console.log(data);
                    var info = data.info;
                    var c=data.count;
                    //console.log(c);
                    var tiao=Math.ceil(c/psize);
                    //console.log(tiao);
                    mui('#pullrefresh').pullRefresh().endPullupToRefresh((++count > tiao));
                    for(var i=0;i<info.length;i++){
                        //info[i].headimg=info[i].headimg.slice(1);
                        if(info[i].status==1){
                            //mui.alert(123); 
                           var str = "<a href='javascript:;' style='height:5rem; padding-bottom:1.3rem'><img class='mui-pull-left' src="+((info[i].headimg)!=0?(info[i].headimg):'/Public/images/head.png')+"><div style='width:0.8rem;height:2.5rem; float:left;'></div><div class='mui-media-body'>金额:"+info[i].money+"<p class='mui-ellipsis'>申请时间:"+info[i].stime+"</p><p class='mui-ellipsis' style='color:green'>申请状态:已发放</p></div></a>"; 
                        }else{
                           var str = "<a href='javascript:;' style='height:5rem; padding-bottom:1.3rem'><img class='mui-pull-left' src="+((info[i].headimg)!=0?(info[i].headimg):'/Public/images/head.png')+"><div style='width:0.8rem;height:2.5rem; float:left;'></div><div class='mui-media-body'>金额:"+info[i].money+"<p class='mui-ellipsis'>申请时间:"+info[i].stime+"</p><p class='mui-ellipsis' style='color:red'>申请状态:尚未通过审核</p></div></a>";  
                        }
                        
                        var li = document.createElement('li');
                        li.innerHTML = str;
                        li.className='mui-table-view-cell mui-media';
                        table.appendChild(li);
                    }
                    mui('#pullrefresh').pullRefresh().endPullupToRefresh(); //refresh completed
                },
                error:function(xhr,type,errorThrown){
                    //异常处理；
                    console.log(xhr);
                }
            });

        }
        function pulldownRefresh() {
            var table = document.body.querySelector('.mui-table-view');
            table.innerHTML='';//追加前先将原来的数据清除
            var cells=document.body.querySelectorAll('.mui-table-view-cell mui-media');
            mui.ajax('/index.php/home/member/down',{
                data:{
                    id:{$_SESSION['msg']['id']},
                },
                type:'post',//HTTP请求类型
                timeout:10000,//超时时间设置为10秒；        
                success:function(data){
                    //console.log(data);
                    var sdata = eval(data);
                    for(var i=0;i<sdata.length;i++){
                        //sdata[i].headimg=sdata[i].headimg.slice(1);
                        if(sdata[i].status==1){
                            var str = "<a href='javascript:;' style='height:5rem; padding-bottom:1.3rem'><img class='mui-pull-left' src="+((sdata[i].headimg)!=0?(sdata[i].headimg):'/Public/images/head.png')+"><div style='width:0.8rem;height:2.5rem; float:left;'></div><div class='mui-media-body'>金额："+sdata[i].money+"<p class='mui-ellipsis'>申请时间："+sdata[i].stime+"</p><p class='mui-ellipsis' style='color:green'>申请状态:已发放</p></div></a>";
                        }else{
                            var str = "<a href='javascript:;' style='height:5rem; padding-bottom:1.3rem'><img class='mui-pull-left' src="+((sdata[i].headimg)!=0?(sdata[i].headimg):'/Public/images/head.png')+"><div style='width:0.8rem;height:2.5rem; float:left;'></div><div class='mui-media-body'>金额："+sdata[i].money+"<p class='mui-ellipsis'>申请时间："+sdata[i].stime+"</p><p class='mui-ellipsis' style='color:red'>申请状态:尚未通过审核</p></div></a>";
                        }
                        var li = document.createElement('li');
                        li.innerHTML = str;
                        
                        li.className='mui-table-view-cell mui-media';
                        table.insertBefore(li,table.firstChild);
                    }
                    mui('#pullrefresh').pullRefresh().endPulldownToRefresh(); //refresh completed
                    //table.innerHTML='';
                },
                error:function(xhr,type,errorThrown){
                    //异常处理；
                    console.log(xhr);
                }
            }); 
        }

        if (mui.os.plus) {
            mui.plusReady(function() {
                setTimeout(function() {
                    mui('#pullrefresh').pullRefresh().pullupLoading();
                }, 1000);
            });
        } else {
            mui.ready(function() {
                mui('#pullrefresh').pullRefresh().pullupLoading();
            });
        }
    </script>
</head>
<body>
    <header class="mui-bar mui-bar-nav">
       <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
       <h1 class="mui-title" style="color: white">我的提现记录</h1>
    </header>
   <!--下拉刷新容器-->
<div id="pullrefresh" class="mui-content mui-scroll-wrapper">
    
    <div class="mui-scroll">
        <!--数据列表-->
        <ul class="mui-table-view">
            
        </ul>
    </div>
    
</div>
    <nav class="mui-bar mui-bar-tab">
        <a class="mui-tab-item" id="index" href='/index.php/home/index/index'>
            <span class="mui-icon mui-icon-home"></span>
            <span class="mui-tab-label">首页</span>
        </a>
        <a class="mui-tab-item" href='/index.php/home/Chat/index'>
            <span class="mui-icon mui-icon-chat"></span>
            <span class="mui-tab-label">群聊</span>
        </a>
        <a id="shop" class="mui-tab-item" href="/index.php/Home/Shop/index">
            <span class="mui-icon"><i class="fa fa-shopping-cart" aria-hidden="true"></i></span>
            <span class="mui-tab-label">商城</span>
        </a>
        <a class="mui-tab-item" href='/index.php/home/member/index'>
            <span class=" mui-icon mui-icon-contact"></span>
            <span class="mui-tab-label">我的</span>
        </a>
    </nav>
</div>
</body>
</html>
